#define _CRT_SECURE_NO_WARNINGS 1

int* masterMind(char* solution, char* guess, int* returnSize) {
    int flag1, flag2, flag3, flag4, flag5, flag6, flag7, flag8;
    flag1 = flag2 = flag3 = flag4 = flag5 = flag6 = flag7 = flag8 = 0;
    for (int i; i < 4; ++i)
    {
        switch (solution[i])
        {
        case'R':
            flag1++;
            break;
        case'Y':
            flag2++;
            break;
        case'G':
            flag3++;
            break;
        case'B':
            flag4++;
            break;
        }
    }
    for (int i; i < 4; ++i)
    {
        switch (guess[i])
        {
        case'R':
            flag5++;
            break;
        case'Y':
            flag6++;
            break;
        case'G':
            flag7++;
            break;
        case'B':
            flag8++;
            break;
        }
    }
    int x1 = flag1 < flag5 ? flag1 : flag5;
    int x2 = flag2 < flag6 ? flag2 : flag6;
    int x3 = flag3 < flag7 ? flag3 : flag7;
    int x4 = flag4 < flag8 ? flag4 : flag8;
    int falseGuess = x1 + x2 + x3 + x4;
    int count = 0;
    for (int i = 0; i < 4; ++i)
    {
        if (solution[i] == guess[i])
        {
            count++;
        }
    }
    falseGuess -= count;
    int* ret = (int*)calloc(2, sizeof(int));
    *returnSize = 2;
    ret[0] = count;
    ret[1] = falseGuess;
    return ret;
}
